package org.springblade.modules.repair.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author: Sharry
 * @createTime: 2025-07-15 14:08
 * @version: Version-1.0
 */
@Getter
@AllArgsConstructor
public enum RescueNoticeTypeEnum {

	TRAPPED("0", "困梯告警", "物联网"),

	LIKE("27", "疑似困人", "物联网"),

	ONE_TOUCH("99", "一键救援", "一键救援"),

	CHAT_GROUP_AI("100", "微信群机器人", "微信群AI机器人");

	final String eventCode;

	final String noticeTypeName;

	final String source;

	/**
	 * 通过事件编码获取对应的告警类型枚举
	 */
	public static RescueNoticeTypeEnum getByEventCode(String eventCode) {
		for (RescueNoticeTypeEnum type : RescueNoticeTypeEnum.values()) {
			if (type.getEventCode().equals(eventCode)) {
				return type;
			}
		}
		return null;
	}

	/**
	 * 通过事件编码获取对应的告警类型名称
	 */
	public static String getNoticeTypeNameByEventCode(String eventCode) {
		for (RescueNoticeTypeEnum type : RescueNoticeTypeEnum.values()) {
			if (type.getEventCode().equals(eventCode)) {
				return type.getNoticeTypeName();
			}
		}
		return null;
	}

	/**
	 * 通过事件编码获取对应的告警类型来源
	 */
	public static String getSourceByEventCode(String eventCode) {
		for (RescueNoticeTypeEnum type : RescueNoticeTypeEnum.values()) {
			if (type.getEventCode().equals(eventCode)) {
				return type.getSource();
			}
		}
		return null;
	}
}
